In a semiconductor device such as metal-oxide-semiconductor field-effect transistors (MOSFETs), metals have been introduced as gate electrode materials in order to avoid the polysilicon depletion effect in a doped polysilicon gate electrode. A replacement-gate (RPG) process has been introduced for fabricating a metal gate electrode. As device dimensions shrink and the gate length is scaled down, it is difficult to form a void-free metal gate structure in the RPG process.